package com.example.demo.controller;

import com.example.demo.entity.Layout;
import com.example.demo.mapper.LayoutMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class LayoutController {
    @Autowired
    private LayoutMapper layoutMapper;

    @GetMapping("/levelLayout")
    public List<Layout> levelLayout(int level) {
        try {
            return layoutMapper.getLevelAllLayout(level);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    @GetMapping("/allLayout")
    public List<Layout> allLayout() {
        try {
            return layoutMapper.getAllLayout();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
}
